package com.cjm.one.system.client;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.annotation.IgnoreTenantForAdmin;
import com.cjm.one.common.constant.ServerConstants;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.system.dto.DeptDto;
import com.cjm.one.model.system.entity.SysDept;
import com.cjm.one.model.system.vo.SysDeptAllVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = ServerConstants.SERVER_ONE_SYSTEM)
public interface SysDeptClient {
    @GetMapping("/admin/system/dept/all")
    @Operation(summary = "获取全部的部门列表信息，并组装成树状结果")
    Result<List<SysDeptAllVo>> getAllList(@RequestParam(name = "deptName",required = false) String deptName, @RequestParam(name = "keyWord",required = false) String keyWord);

    @PostMapping("/admin/system/dept/list")
    @Operation(summary = "获取当前登录用户下的部门列表信息")
    Result<Page<SysDept>> getUserDeptList(@RequestBody DeptDto deptDto);

    @PostMapping("/admin/system/dept")
    @Operation(summary = "新增部门信息")
    Result<Boolean> save(@RequestBody SysDept sysDept);

    @PutMapping("/admin/system/dept")
    @Operation(summary = "更新部门信息")
    Result<Boolean> update(@RequestBody SysDept sysDept);
    @GetMapping("/admin/system/dept/{id}")
    @Operation(summary = "根据id获取部门详情")
    Result<SysDept> getById(@PathVariable Long id);
    @DeleteMapping("/admin/system/dept/{id}")
    @Operation(summary = "根据id删除部门")
    Result<Boolean> removeById(@PathVariable Long id);
}
